import request from '@/config/axios'

// Offer主 VO
export interface ProjectOfferVO {
  id: number // 主键
  projectId: number // 项目ID
  employerId: number // 雇主ID
  wordkId: number // 人才ID
  offerStatus: number // 状态：1-待发送 2-已发送 3-已接受 4-已拒绝 5-已过期 6-已撤销
  expireTime: Date // Offer过期时间
  acceptTime: Date // 接受时间
  rejectTime: Date // 拒绝时间
  rejectReason: string // 拒绝原因
  cancelTime: Date // 撤销时间
  cancelReason: string // 撤销原因
}

// Offer主 API
export const ProjectOfferApi = {
  // 查询Offer主分页
  getProjectOfferPage: async (params: any) => {
    return await request.get({ url: `/member/project-offer/page`, params })
  },

  // 查询Offer主详情
  getProjectOffer: async (id: number) => {
    return await request.get({ url: `/member/project-offer/get?id=` + id })
  },

  // 新增Offer主
  createProjectOffer: async (data: ProjectOfferVO) => {
    return await request.post({ url: `/member/project-offer/create`, data })
  },

  // 修改Offer主
  updateProjectOffer: async (data: ProjectOfferVO) => {
    return await request.put({ url: `/member/project-offer/update`, data })
  },

  // 删除Offer主
  deleteProjectOffer: async (id: number) => {
    return await request.delete({ url: `/member/project-offer/delete?id=` + id })
  },

  // 导出Offer主 Excel
  exportProjectOffer: async (params) => {
    return await request.download({ url: `/member/project-offer/export-excel`, params })
  },
}
